﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ScormModel
{
    public class TreeUtil
    {
        public static TreeViewItem GetTreeView(string text, string imagePath)
        {
            TreeViewItem item = new TreeViewItem();

            item.IsExpanded = true;

            // create stack panel
            StackPanel stack = new StackPanel();
            stack.Orientation = Orientation.Horizontal;

            // create Image
            Image image = new Image();
            image.Source = new BitmapImage(new Uri("pack://application:,,/Images/" + imagePath));

            // Label
            Label lbl = new Label();
            lbl.Name = "test";
            lbl.Content = text;


            // Add into stack
            stack.Children.Add(image);
            stack.Children.Add(lbl);

            // assign stack to header
            item.Header = stack;
            return item;

        }

        private static TreeViewItem GetTreeView(string text, Color boxColor)
        {
            TreeViewItem item = new TreeViewItem();
            item.IsExpanded = true;
            // create stack panel
            StackPanel stack = new StackPanel();
            stack.Orientation = Orientation.Horizontal;
            // create Image
            Border border = new Border();
            border.Width = 8;
            border.Height = 12;
            border.Background = new SolidColorBrush(boxColor);
            // Label
            Label lbl = new Label();
            lbl.Content = text;
            stack.Children.Add(border);
            stack.Children.Add(lbl);

            //item.HeaderTemplate.ad  


            item.Header = stack;
            return item;

        }
    }
}
